﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Books.aspx.cs" Inherits="BookNet.Admin.Books" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:booknetConnectionString1 %>" 
            DeleteCommand="DELETE FROM [app_Books] WHERE [BookID] = @BookID" 
            InsertCommand="INSERT INTO [app_Books] ([BookID], [Seller], [Title], [Description], [Price], [TimeAdded], [CoverImageUrl], [ForLending], [Condition], [ISBN], [Author]) VALUES (@BookID, @Seller, @Title, @Description, @Price, @TimeAdded, @CoverImageUrl, @ForLending, @Condition, @ISBN, @Author)" 
            SelectCommand="SELECT * FROM [app_Books]" 
            UpdateCommand="UPDATE [app_Books] SET [Seller] = @Seller, [Title] = @Title, [Description] = @Description, [Price] = @Price, [TimeAdded] = @TimeAdded, [CoverImageUrl] = @CoverImageUrl, [ForLending] = @ForLending, [Condition] = @Condition, [ISBN] = @ISBN, [Author] = @Author WHERE [BookID] = @BookID">
            <DeleteParameters>
                <asp:Parameter Name="BookID" Type="Object" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Seller" Type="Object" />
                <asp:Parameter Name="Title" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="Price" Type="Decimal" />
                <asp:Parameter Name="TimeAdded" Type="DateTime" />
                <asp:Parameter Name="CoverImageUrl" Type="String" />
                <asp:Parameter Name="ForLending" Type="Boolean" />
                <asp:Parameter Name="Condition" Type="String" />
                <asp:Parameter Name="ISBN" Type="Int64" />
                <asp:Parameter Name="Author" Type="String" />
                <asp:Parameter Name="BookID" Type="Object" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="BookID" Type="Object" />
                <asp:Parameter Name="Seller" Type="Object" />
                <asp:Parameter Name="Title" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:Parameter Name="Price" Type="Decimal" />
                <asp:Parameter Name="TimeAdded" Type="DateTime" />
                <asp:Parameter Name="CoverImageUrl" Type="String" />
                <asp:Parameter Name="ForLending" Type="Boolean" />
                <asp:Parameter Name="Condition" Type="String" />
                <asp:Parameter Name="ISBN" Type="Int64" />
                <asp:Parameter Name="Author" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
    
    </div>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="BookID" 
        DataSourceID="SqlDataSource1" PageSize="20">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
            <asp:BoundField DataField="BookID" HeaderText="BookID" ReadOnly="True" 
                SortExpression="BookID" />
            <asp:BoundField DataField="Seller" HeaderText="Seller" 
                SortExpression="Seller" />
            <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
            <asp:BoundField DataField="Description" HeaderText="Description" 
                SortExpression="Description">
            <ControlStyle Height="20px" />
            </asp:BoundField>
            <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
            <asp:BoundField DataField="TimeAdded" HeaderText="TimeAdded" 
                SortExpression="TimeAdded" />
            <asp:BoundField DataField="CoverImageUrl" HeaderText="CoverImageUrl" 
                SortExpression="CoverImageUrl" />
            <asp:CheckBoxField DataField="ForLending" HeaderText="ForLending" 
                SortExpression="ForLending" />
            <asp:BoundField DataField="Condition" HeaderText="Condition" 
                SortExpression="Condition" />
            <asp:BoundField DataField="ISBN" HeaderText="ISBN" SortExpression="ISBN" />
            <asp:BoundField DataField="Author" HeaderText="Author" 
                SortExpression="Author" />
        </Columns>
    </asp:GridView>
    </form>
</body>
</html>
